Skip to content

Conversation

HeyRicha
Copy link
Contributor

Key Changes:

New Entity Types:

  • Defined VideoClipEntity and TvShowEntity.
  • Updated the EntityType enum to include VideoClip and TvShow.

Continue Watching:

  • Integrated VideoClipEntity into the "Continue Watching" feature.
  • Updated ContinueWatchingEntity to correctly handle properties of the new entity types

Engage SDK Integration

  • Added logic to convert the new VideoClipEntity into an EngageVideoClipEntity

UI Updates:

  • Modified the UI to display information for VideoClipEntity

episodeNumber = entity.episodeNumber,
)
is VideoClipEntity -> entity.name
else -> throw IllegalStateException("Unsupported video type for Continue Watching: $entity")
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's change the else to is TvShowEntity instead.


is VideoClipEntity -> null

else -> throw IllegalStateException("Unsupported video type for Continue Watching: $entity")
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's change the else to is TvShowEntity instead.

val genre: String,
val seasonCount: Integer,
val duration: Duration,
var nextTvShowEntity: TvShowEntity?,
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's remove this as a TvShowEntity doesn't have a next show.

val platformSpecificUris: PlatformSpecificUris,
val releaseYear: Int,
val genre: String,
val seasonCount: Integer,
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's remove the season count for now. When we want to make use of seasons, we can create a new entity called TvSeasonEntity and then add a new field to the TvShowEntity called val seasons: List<TvSeasonEntity>. Then, we can create a getter which returns the seasonCount.

data class TvShowEntity(
  ...
) {
  val seasonCount = seasons.size()
}

This way, we will avoid having fragmented state and it will help us prevent out-of-sync issues.

val duration: Duration
val name: String
val playbackUris: PlatformSpecificUris
val images: List<Image>
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: we can keep the images field as well in the VideoEntity interface as all video entities will have images.

Comment on lines +18 to +33
else -> throw IllegalStateException("Unsupported video type for Continue Watching: $entity")
}
val duration: Duration
get() = when (entity) {
is MovieEntity -> entity.duration
is TvEpisodeEntity -> entity.duration
is VideoClipEntity -> entity.duration
else -> throw IllegalStateException("Unsupported video type for Continue Watching: $entity")
}

val genre: String
get() = when (entity) {
is MovieEntity -> entity.genre
is TvEpisodeEntity -> entity.genre
is VideoClipEntity -> entity.genre
else -> throw IllegalStateException("Unsupported video type for Continue Watching: $entity")
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's change the else to is TvShowEntity instead.

The benefit is that when we add a new entity type in future, we will be warned by compiler that we need to update this place. If we use the generic else, we might forget to update some place and the app will crash at runtime.

is MovieEntity -> entity.convertToEngageMovieEntity(this)
is TvEpisodeEntity -> entity.convertToEngageTvEpisodeEntity(this)
is VideoClipEntity -> entity.convertToEngageVideoClipEntity(this)
else -> throw IllegalStateException("Unsupported video type for Continue Watching: $entity")
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's change the else to is TvShowEntity instead.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants